Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/settings/src/androidMain/kotlin/org/meshtastic/feature/settings/component/PrivacySection.kt 1390a3cd4f7bc55a37433d1d868e65c01678eb31 (1390a3cd) Text, 4.27 KB

T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.component

Tff7b72import T7ee787android.Manifest
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.LaunchedEffect
Tff7b72import T7ee787androidx.compose.ui.platform.LocalContext
Tff7b72import T7ee787androidx.compose.ui.tooling.preview.Preview
Tff7b72import T7ee787com.google.accompanist.permissions.ExperimentalPermissionsApi
Tff7b72import T7ee787com.google.accompanist.permissions.rememberMultiplePermissionsState
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.common.gpsDisabled
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.analytics_okay
Tff7b72import T7ee787org.meshtastic.core.resources.app_settings
Tff7b72import T7ee787org.meshtastic.core.resources.location_disabled
Tff7b72import T7ee787org.meshtastic.core.resources.provide_location_to_mesh
Tff7b72import T7ee787org.meshtastic.core.ui.component.SwitchListItem
Tff7b72import T7ee787org.meshtastic.core.ui.icon.BugReport
Tff7b72import T7ee787org.meshtastic.core.ui.icon.LocationOn
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.theme.AppTheme
Tff7b72import T7ee787org.meshtastic.core.ui.util.showToast

T8b949e/** Section managing privacy settings like analytics and location sharing. */
Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalPermissionsApiTff7b72::Te6edf3classTb4b4b4)
Tf0883e@Composable
Tff7b72fun Td2a8ffPrivacySectionTb4b4b4(
Te6edf3analyticsAvailableTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3analyticsEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleAnalyticsTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3provideLocationTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleLocationTb4b4b4: Tb4b4b4(Tffa657BooleanTb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3homoglyphEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleHomoglyphTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3startProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3stopProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3context Tff7b72= Te6edf3LocalContextTb4b4b4.Te6edf3current
Tff7b72val Te6edf3locationPermissionsState Tff7b72=
Te6edf3rememberMultiplePermissionsStateTb4b4b4(Te6edf3permissions Tff7b72= Te6edf3listOfTb4b4b4(Te6edf3ManifestTb4b4b4.Te6edf3permissionTb4b4b4.Te6edf3ACCESS_FINE_LOCATIONTb4b4b4)Tb4b4b4)
Tff7b72val Te6edf3isGpsDisabled Tff7b72= Te6edf3contextTb4b4b4.Te6edf3gpsDisabledTb4b4b4(Tb4b4b4)

Te6edf3LaunchedEffectTb4b4b4(Te6edf3provideLocationTb4b4b4, Te6edf3locationPermissionsStateTb4b4b4.Te6edf3allPermissionsGrantedTb4b4b4, Te6edf3isGpsDisabledTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3provideLocationTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3locationPermissionsStateTb4b4b4.Te6edf3allPermissionsGrantedTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3isGpsDisabledTb4b4b4) Tb4b4b4{
Te6edf3startProvideLocationTb4b4b4(Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3contextTb4b4b4.Te6edf3showToastTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_disabledTb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3locationPermissionsStateTb4b4b4.Te6edf3launchMultiplePermissionRequestTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3stopProvideLocationTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Te6edf3ExpressiveSectionTb4b4b4(Te6edf3title Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3app_settingsTb4b4b4)Tb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3analyticsAvailableTb4b4b4) Tb4b4b4{
Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3analytics_okayTb4b4b4)Tb4b4b4,
Te6edf3checked Tff7b72= Te6edf3analyticsEnabledTb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3BugReportTb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onToggleAnalyticsTb4b4b4,
Tb4b4b4)
Tb4b4b4}

Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3provide_location_to_meshTb4b4b4)Tb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LocationOnTb4b4b4,
Te6edf3enabled Tff7b72= Tff7b72!Te6edf3isGpsDisabledTb4b4b4,
Te6edf3checked Tff7b72= Te6edf3provideLocationTb4b4b4,
Te6edf3onClick Tff7b72= Tb4b4b4{ Te6edf3onToggleLocationTb4b4b4(Tff7b72!Te6edf3provideLocationTb4b4b4) Tb4b4b4}Tb4b4b4,
Tb4b4b4)

Te6edf3HomoglyphSettingTb4b4b4(Te6edf3homoglyphEncodingEnabled Tff7b72= Te6edf3homoglyphEnabledTb4b4b4, Te6edf3onToggle Tff7b72= Te6edf3onToggleHomoglyphTb4b4b4)
Tb4b4b4}
Tb4b4b4}

Tf0883e@PreviewTb4b4b4(Te6edf3showBackground Tff7b72= Tff7b72trueTb4b4b4)
Tf0883e@Composable
Tff7b72private Tff7b72fun Td2a8ffPrivacySectionPreviewTb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3AppTheme Tb4b4b4{
Te6edf3PrivacySectionTb4b4b4(
Te6edf3analyticsAvailable Tff7b72= Tff7b72trueTb4b4b4,
Te6edf3analyticsEnabled Tff7b72= Tff7b72trueTb4b4b4,
Te6edf3onToggleAnalytics Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3provideLocation Tff7b72= Tff7b72trueTb4b4b4,
Te6edf3onToggleLocation Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3homoglyphEnabled Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3onToggleHomoglyph Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3startProvideLocation Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3stopProvideLocation Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.05s